home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_23_1988_Transactor_Publishing.d64 / automata 64 (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  4KB  |  126 lines

  1. 10 gosub 650
  2. 20 automata 64   by ian adam
  3. 30 :
  4. 40 : main loop
  5. 50 :
  6. 60 print tab(6)r$"[145]":input"code";r$
  7. 70 a=5887:for i=1 to 10
  8. 80 poke a+i,val(mid$(r$,i,1)) and 3
  9. 90 next
  10. 100 :
  11. 110 print "seed value  1[157][157][157]";:input b$
  12. 120 if val(b$)=0 then 250
  13. 130 print "position (1-40)  20[157][157][157][157]";:input a
  14. 140 gosub 540:for i=8192 to 8504 step 8:poke i,0:next
  15. 150 poke 8184+8*a,val(b$) and 255
  16. 160 :
  17. 170 sys 5900
  18. 180 :
  19. 190 for i=0 to 999:if peek(k) then 240
  20. 200 next:gosub 590:print"m more of this  p print this
  21. 210 [153]"s new seed  r random seed
  22. 220 print"c new code  a automatic codes
  23. 230 [153]"v view plot  q quit";
  24. 240 [146] k,7:[161] b$
  25. 250 [129] i[178]1 [164] 7:[139] [202]("srmcapq",i,1) [179][177] b$ [167] [130]
  26. 260 [145] i [137] 290,310,330,370,390,490,610
  27. 270 [141] 540:[137] 190
  28. 280 :
  29. 290 [141] 590:[137] 110:[162] seed
  30. 300 :
  31. 310 r[178]255:[150] [165]s(x)[178][187](x)[172]r:[137] 340:r[175]om seed
  32. 320 :
  33. 330 r[178]7687:[150] [165]s(x)[178][194](r[170]x):[143] copy last line
  34. 340 [129] i[178]8192 [164] 8504 [169] 8
  35. 350 [151] i,[165]s(i):[130]:[141] 540:[137] 170
  36. 360 :
  37. 370 [141] 590:[137] 60:[162] code
  38. 380 :
  39. 390 [141] 540:r[178]255:[129] j[178]0 [164] 1:r$[178]"":[143] automatic
  40. 400 [129] l[178]5888 [164] 5897:a[178][187](l)[172]4
  41. 410 [151] l,a:r$[178]r$[170][199](48[170]a):[130]
  42. 420 :
  43. 430 [129] l[178]8192 [164] 8504 [169] 8
  44. 440 [151] l,[187](l)[172]r:[130]
  45. 450 :
  46. 460 [158] 5900
  47. 470 j[178][194](k):[130]:[151] k,0:[137] 190
  48. 480 :
  49. 490 [141] 540:a$[178][199](10):[159] 4,4,5:[143] 2nd addrs grafix, no lf
  50. 500 [157] 4:[158] 6060
  51. 510 [153]a$a$[199](14)"code: "r$a$a$
  52. 520 [152]4:[160] 4:[137] 190
  53. 530 :
  54. 540 [139] [194](v)[178]59 [167] [142]
  55. 550 [151] v,59:[151] v[170]5,216:[151] v[170]7,24:[143] hires
  56. 560 [153]"cont";:[129] i[178]1 [164] 111:[153]"---------";:[130]
  57. 570 [151] 2023,173:[151] 56295,14:[142]:col[176]s
  58. 580 :
  59. 590 [151] v,27:[151] v[170]5,200:[151] v[170]7,21:[153]:[142]:text
  60. 600 :
  61. 610 [158] 65409:[128]
  62. 620 :
  63. 630 : start[171]up
  64. 640 :
  65. 650 [151] 53280,0:[151] 53281,0:[151] 46,64:[156]:k[178]198:v[178]53265
  66. 660 :
  67. 670 [153]"load  cellular automata for the 64
  68. 680 print"this program creates complex
  69. 690 [153]"geometric artforms on the screen.
  70. 700 print"the image is generated line-by-line
  71. 710 [153]"according to these rules:
  72. 720 print"[158]- a pixel has a colour value 0,1,2,3
  73. 730 [153]"- add the values of 3 adjoining pixels
  74. 740 print"  in a line.
  75. 750 [153]"- the sum (0-9) is used to select a
  76. 760 print"  new colour from the code you specify.
  77. 770 [153]"- this new colour is plotted as the
  78. 780 print"  pixel directly below.
  79. 790 [153]"- the code has 10 digits, corresponding
  80. 800 print"  to the 10 values of the sum (0-9).
  81. 810 [153]"automata were introduced in scientific
  82. 820 print"american in 1971 & 1984, and a version
  83. 830 [153]"appeared in byte magazine in 1986. this
  84. 840 print"enhanced version for the 64 is by
  85. 850 [153]"ian adam & transactor magazine, 1987.
  86. 860 if peek(5900)-160 then gosub 1100
  87. 870 print"[158]press return!":input a$
  88. 880 :
  89. 890 print"[147]  instructions:
  90. 900 [153]"you enter a 10-digit rule, using
  91. 910 print"the digits 0, 1, 2, and 3.
  92. 920 [153]"next, enter a seed value which
  93. 930 print"is plotted on the top line.
  94. 940 [153]"if you enter r, a random seed is used.
  95. 950 print"if you enter a seed #, you must
  96. 960 [153]"also supply its position on the line.
  97. 970 print"[158]after plotting, press:
  98. 980 [153]"- s  enter a new seed
  99. 990 print"- r  for a random seed
  100. 1000 [153]"- m  more of the same plot
  101. 1010 print"- c  enter new code
  102. 1020 [153]"- a  automatic code generation
  103. 1030 print"- p  send pattern to printer
  104. 1040 [153]"- q  quit
  105. 1050 print"the current code will be shown like
  106. 1060 [153]"this. make any changes & press return:
  107. 1070 r$="0120123123
  108. 1080 [137] 60
  109. 1090 :
  110. 1100 [129] i[178]5900 [164] 6132:[135] a:[151] i,a:[130]
  111. 1110 [142]
  112. 1120 :
  113. 1130 [131]160,32,132,251,132,253,160,1,132,252,136,132,250,162,199,134,166,162
  114. 1140 [131]39,134,167,132,169,177,250,133,168,165,167,240,4,160,8,177,250,10
  115. 1150 [131]38,168,42,38,168,42,41,3,133,170,160,4,169,0,38,168,42,38
  116. 1160 [131]168,42,72,101,170,101,169,170,165,170,133,169,104,133,170,189,0,23
  117. 1170 [131]6,254,6,254,5,254,133,254,136,208,221,145,252,24,198,167,16,40
  118. 1180 [131]162,2,181,250,41,7,201,7,240,15,56,181,250,233,55,149,250,181
  119. 1190 [131]251,233,1,149,251,208,6,246,250,208,2,246,251,202,202,240,223,198
  120. 1200 [131]166,208,144,96,162,2,181,250,105,8,149,250,144,3,246,251,24,202
  121. 1210 [131]202,240,241,76,35,23,27,65,8,13,10,27,75,64,1,0,160,32
  122. 1220 [131]132,251,160,0,132,250,160,25,132,252,160,0,185,162,23,32,210,255
  123. 1230 [131]200,192,9,208,245,160,40,132,253,160,7,177,250,162,7,42,118,166
  124. 1240 [131]202,16,250,136,16,243,169,7,170,56,101,250,133,250,144,2,230,251
  125. 1250 [131]181,166,32,210,255,202,16,248,198,253,208,217,198,252,208,196,96
  126.